package com.enation.app.shop.front.policyInsurance.service.impl;

import com.enation.app.shop.front.policyInsurance.entity.ClaimResult;
import com.enation.app.shop.front.policyInsurance.service.ClaimResultMapper;
import com.enation.framework.database.IDaoSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Calendar;
import java.util.List;

@Service("claimResultService")
public class ClaimResultService implements ClaimResultMapper{
    @Autowired
    private IDaoSupport daoSupport;
    @Override
    public int deleteByPrimaryKey(Long id) {
        return 0;
    }

    @Override
    public int insert(ClaimResult record) {
        this.daoSupport.insert("rbt_claims_result",record);
        return 1;
    }

    @Override
    public int insertSelective(ClaimResult record) {
        return 0;
    }

    @Override
    public ClaimResult selectByPrimaryKey(Long id) {
        return null;
    }

    @Override
    public int updateByPrimaryKeySelective(ClaimResult record) {
        return 0;
    }

    @Override
    public int updateByPrimaryKey(ClaimResult record) {
        return 0;
    }

    @Override
    public List<ClaimResult> getByuserid(Integer userid) {
        Calendar a= Calendar.getInstance();
        Integer year=a.get(Calendar.YEAR);//得到年
        String sql="select * from rbt_claims_result where insured_breed_id=?  and   year(date)='"+year+"'";
        return this.daoSupport.queryForList(sql,ClaimResult.class,userid);
    }

    @Override
    public ClaimResult getByClaimid(Long claimid) {
        String sql="select * from rbt_claims_result where claims_settlement_id=?";
        return this.daoSupport.queryForObject(sql,ClaimResult.class,claimid);
    }
}
